﻿namespace EyeOpen.Data.Nibernate.Mapping
{
    using EyeOpen.Domain;

    public abstract class OwnedHistoryMap<T> : LogicalEntityMap<T> where T : OwnedHistoryEntity<T>, new()
    {
        protected OwnedHistoryMap() 
        {
            Version(x => x.Version);

            References(x => x.Previous)
                .NotFound.Exception()
                .ColumnName("PreviousId");

            References(x => x.User)
                .Not.Nullable()
                .NotFound.Exception()
                .ColumnName("UserId");
        }
    }
}